<#assign base=(rc.getContextPath())!''>
<html>
<head>
	<title>Emp List</title>
	<script language="javascript" src="${base}/res/js/common.js"></script>
	<script language="javascript" src="${base}/res/js/jquery-1.7.1.js"></script>
</head>

<body>
	redirect传递参数：${attribute!}
	<br/><br/><br/>
	<input type="button" value="js" onclick="justalert();"/>
	<a href="${base}/emp/add">新增</a>
	<a href="${base}/emp/page/1">URL显式分页</a>
	<a href="${base}/emp/page">ajax分页</a>
	<br/><br/><br/>
	<form action="${base}/emp" method="post">
	<table style="width:60%;" align="center" border="1">
		<tr>
			<th colspan="4">查询条件</th>
		</tr>
		<tr>
			<td align="right"><b>ename</b></td>
			<td><input type="text" name="ename"/></td>
			<td align="right"><b>dname</b></td>
			<td><input type="text" name="dname"/></td>
		</tr>
		<tr>
			<td></td>
			<td colspan="3"><input type="submit" value="查询"/></td>
		</tr>
	</table>
	<form>
	<br/><br/><br/>
	<table style="width:60%;" align="center" border="1">
		<tr>
			<th>序号</th>
			<th>empno</th>
			<th>ename</th>
			<th>操作</th>
		</tr>
	  	<#list list as item>
	  		<tr align="center">
	  			<td>${item_index+1}</td>
		  		<td>${item.EMPNO}</td>
		  		<td>${item.ENAME}</td>
		  		<td>
		  			<a href="${base}/emp/${item.EMPNO}/edit.html">修改</a> | 
		  			<a href="${base}/emp/${item.EMPNO}/put.html">PUT</a> |
		  			<a href="javascript:void(0)" onclick="deleteOne('${item.EMPNO}')">删除</a>
		  		</td>
		  	</tr>
	  	</#list>
	</table>
	
</body>
<script>
function deleteOne(empno) {
	$.ajax({
		url: "${base}/emp/"+empno,
		type: "POST", //DELETE也可，但据说不是所有浏览器都支持，但据说目前浏览器基本都支持。。
		data: {'_method':'DELETE', 'zwparam':'中文会不会乱码'},
		//dataType: 'json',
		success: function(data) {
			alert(data);
			//alert(data.msg);
			//window.href="${base}/emp";
		},
		error: function(request, err) {
			alert("error：" + err);
		}
	})
}
</script>
</html>